package br.com.gip.commons.base.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="CARGO")
public class Cargo implements Serializable {

	private static final long serialVersionUID = -4807465437127330463L;

	@Id
	@Column(name="CARGO_ID")
	@SequenceGenerator(name="SQ_CARGO_PK", sequenceName="SQ_CARGO_PK", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SQ_CARGO_PK")
	private Long cargoId;
	
	@Column(name="FUNCAO", unique=true, nullable=false, length=64)
	private String funcao;
	
	@Column(name="DESCRICAO", length=128)
	private String descricao;

	public Long getCargoId() {
		return cargoId;
	}

	public void setCargoId(Long cargoId) {
		this.cargoId = cargoId;
	}

	public String getFuncao() {
		return funcao;
	}

	public void setFuncao(String funcao) {
		this.funcao = funcao;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((cargoId == null) ? 0 : cargoId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Cargo other = (Cargo) obj;
		if (cargoId == null) {
			if (other.cargoId != null) {
				return false;
			}
		} else if (!cargoId.equals(other.cargoId)) {
			return false;
		}
		return true;
	}
	
}
